<%= turbo_stream_from "rooms" %>

<% if false %>
<div class="container">
<%= turbo_stream_from "users" %>
<%= turbo_frame_tag "users" do %>
      <%= render @users %>
<% end %>
  <h3>Users</h3>
  <% @users.each do |user| %>
    <%= button_to "Chat with #{user.username}", {controller: 'rooms', action: 'create'}, method: :post, params: {receiver_id: user.id} %>
  <% end %>
<%end%>
  <h3> 私信 </h3>
  <h4>我发起的</h4>
  <% if @sender_rooms %>
    <%# <% render @sender_rooms%> 
    <% @sender_rooms.each do |room| %>
        <tr>
          <td><%= link_to room.sender.username+"和"+room.receiver.username+"的聊天", room %></td>
        </tr>
    <% end %>
  <%end%>
  <h4>我收到的</h4>
  <% if @receiver_rooms %>
    <%# <% render @sender_rooms%> 
    <% @receiver_rooms.each do |room| %>
        <tr>
          <td><%= link_to room.sender.username+"和"+room.receiver.username+"的聊天", room %></td>
        </tr>
    <% end %>
  <%end%>
</div>